#if !defined(_SSTRUCTTYPEDESCRIPTOR_H)
#define _SSTRUCTTYPEDESCRIPTOR_H

#include <boost/foreach.hpp>

#include "TypeDescriptor.h"
#include "SStructMember.h"

CREATE_ALIAS( SStructTypeDescriptor );

/**
 * Class used to store a struct type descriptor.
 */
class DECLARATION_DLL SStructTypeDescriptor : public TypeDescriptor
{
	/** Vector of members */
	SStructMemberSpVectorSp members;

	/** SStructTypeDescriptor constructor to create the type descriptor for a SStruct */
	SStructTypeDescriptor(string pluginName, string name, string description) : TypeDescriptor(pluginName, name, description)
	{
		members = SStructMemberSpVectorSp(new SStructMemberSpVector);
	}

public:

    /**
     * Add a simple type member in the struct definition.
     */
	virtual void AddMember(string name, string description, SType type);

    /**
     * Add a complex type member in the struct definition.
     */
	virtual void AddMember(string name, string description, TypeDescriptorSp typeDescriptor);

	/**
	 * Get info of the member in index position inside the struct definition.
	 */
	virtual SStructMemberSp GetMember(int index);

	/**
	 * Get info of a member with a specific name.
	 */
	virtual SStructMemberSp GetMember(string name);

	/**
	 * Return true if a member with a specific name is defined.
	 */
	virtual bool IsDefined(string name);

	/**
	 * Return the position of a member with a specific name inside the struct definition.
	 */
	virtual int GetMemberPosition(string name);

	/**
     * Delete all members in the struct definition.
     */
	virtual void ClearMembers()
	{
		members->clear();
	}

    /**
     * Return the number of members defined.
     */
	virtual int GetNumberOfMembers()
	{
		return members->size();
	}

    /**
     * Returns true if the struct type descriptor is valid.
     */
	virtual bool IsValid()
	{
		return true;
	}

	/**
	 * Returns true if the type descriptor describe the type specified.
	 */
	virtual bool Describe(SType type)
	{
		return type == STypeStruct;
	}

	/**
	* Returns the type described from this type descriptor (STypeStruct).
	*/
	virtual SType GetDescribedType()
	{
		return STypeStruct;
	}

	/**
	 * Factory method to create the type descriptor for a SStruct.
	 */
	static SStructTypeDescriptorSp Create(string pluginName, string name, string description);
};

#endif  //_SSTRUCTTYPEDESCRIPTOR_H
